﻿using System;
using System.Collections.Generic;
using System.Text;
using StockTrader.BusinessService.DataContract;

namespace StockTrader.FrontEnd.DataContract
{
    public class IndicatorCodeUI
    {
        private int _id;
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }
        private string _name;
        public string Name
        {
            get { return _name; }
            set { _name = value.Trim(); }
        }
        private string _code;
        public string Code
        {
            get { return _code; }
            set { _code = value.Trim(); }
        }
        private string _description;
        public string Description
        {
            get { return _description; }
            set { _description = value.Trim(); }
        }
        private int _docType;
        public int DocType
        {
            get { return _docType; }
            set { _docType = value; }
        }
        private string _docTypeText;
        public string DocTypeText
        {
            get { return _docTypeText; }
            set { _docTypeText = value; }
        }
        private int _type;
        public int Type
        {
            get { return _type; }
            set { _type = value; }
        }
        private string _typeText;
        public string TypeText
        {
            get { return _typeText; }
            set { _typeText = value; }
        }
        private int _lang;
        public int Lang
        {
            get { return _lang; }
            set { _lang = value; }
        }
        private string _langText;
        public string LangText
        {
            get { return _langText; }
            set { _langText = value; }
        }
        private int _parrent;
        public int Parrent
        {
            get { return _parrent; }
            set { _parrent = value; }
        }
        private int _position;
        private string _parrentText;
        public string ParrentText
        {
            get { return _parrentText; }
            set { _parrentText = value; }
        }
        public int Position
        {
            get { return _position; }
            set { _position = value; }
        }
        private int _level;
        public int Level
        {
            get { return _level; }
            set { _level = value; }
        }
        private string _formular;
        public string Formular
        {
            get { return _formular; }
            set { _formular = value; }
        }

        public IndicatorCodeUI()
        {
            this._level = -1;
        }
        public IndicatorCodeUI(int id, string name, string code, string description, int doctype, string doctypetext, int type, string typetext, int lang, string langtext, int parrent, string parrenttext, int position, int level, string formular)
        {
            this._id = id;
            this._name = name;
            this._code = code;
            this._description = description;
            this._type = type;
            this._lang = lang;
            this._langText = langtext;
            this._parrent = parrent;
            this._parrentText = parrenttext;
            this._position = position;
            this._level = level;
            this._formular = formular;
            this._docType = doctype;
            this._docTypeText = doctypetext;
            this._typeText = typetext;
        }

        public IndicatorCodeData ConvertToData()
        {
            return new IndicatorCodeData(this._name, this._description, this._description, this._docType, this._type, this._parrent, this._position, this._level, this._formular);
        }
        public override string ToString()
        {
            if (this._name != null)
                return this._name.Trim() + " (" + this._code.Trim() + ")";
            else
                return String.Empty;
        }
    }
}
